<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta charset="utf-8">
    <title>添加书籍</title>

    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <!-- page specific plugin styles -->
    <script src="__PUBLIC__/admin/js/jquery.min.js"></script>
    <script src="__PUBLIC__/admin/js/lodash.min.js"></script>
    <script src="__PUBLIC__/admin/js/moment.min.js"></script>
    <script src="__PUBLIC__/admin/js/zh-cn.js"></script>
    <script src="__PUBLIC__/admin/js/numeral.min.js"></script>
    <script src="__PUBLIC__/admin/js/toastr.min.js"></script>
    <script src="__PUBLIC__/admin/js/cookies.js"></script>
    <script src="__PUBLIC__/admin/js/knockout-min.js"></script>
    <script src="__PUBLIC__/admin/js/knockout.mapping.min.js"></script>
    <script src="__PUBLIC__/admin/js/bootstrap-datetimepicker.min.js"></script>
    <script src="__PUBLIC__/admin/js/jquery.validate.min.js"></script>
    <script src="__PUBLIC__/admin/js/jquery.validate.unobtrusive.min.js"></script>
    <script src="__PUBLIC__/admin/js/clipboard.min.js"></script>
    <script src="__PUBLIC__/admin/js/select2.min.js"></script>
    <script src="__PUBLIC__/admin/js/admin.js"></script>
    <script>
      moment.locale('zh-cn');
      toastr.options.positionClass = 'toast-bottom-right';
    </script>

    <script src="__PUBLIC__/admin/js/ace-extra.min.js"></script>

<link media="all" href="__PUBLIC__/admin/css/index14.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/glyphicons-halflings-regular.css">
</head>
<body class="no-skin">

    <!-- #section:basics/navbar.layout -->
<include file="./Public/gong/title.html" />

    <div class="main-container" id="main-container">
      <script type="text/javascript">
        try{ace.settings.check('main-container' , 'fixed')}catch(e){}
      </script>

      <div id="sidebar" class="sidebar responsive">
          <script type="text/javascript">
            try{ace.settings.check('sidebar' , 'fixed')}catch(e){}
          </script>

<include file="./Public/gong/list.html" />


          <div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
            <i class="ace-icon fa fa-angle-double-left" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>
          </div>

          <script type="text/javascript">
            try{ace.settings.check('sidebar' , 'collapsed')}catch(e){}
          </script>
      </div>

      <!-- /section:basics/sidebar -->
      <div class="main-content">


        <div class="breadcrumbs" id="breadcrumbs">
          <script type="text/javascript">
            try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
          </script>

          <ul class="breadcrumb">
            <li>
              <i class="ace-icon fa fa-home home-icon"></i>
              <a    href="#">Home</a>
            </li>
            <li class="active">发布小说</li>
          </ul><!-- /.breadcrumb -->

          <!-- /section:basics/content.searchbox -->
        </div>

        <!-- /section:basics/content.breadcrumbs -->
        <div class="page-content">
          <div class="page-content-area">
            <div class="row">
              <div class="col-xs-12">
<div style="margin-bottom: 30px;">
    <ul class="nav nav-tabs">
        <li class=""><a href="__URL__/add_book_type.html">添加书籍分类</a></li>
        <li class=""><a href="__URL__/add_book_txt.html">添加书籍(上传TXT)</a></li>
        <li class="active"><a href="__URL__/add_book.html">添加书籍</a></li>
        <li class=""><a href="__URL__/add_book_info.html">添加章节</a></li>
    </ul>
</div>
<form id="main-form" class="form-horizontal"   method="POST" action="__URL__/do_add_book" enctype="multipart/form-data">
    <div class="form-group">
        <label class="control-label col-sm-3">采集地址</label>
        <div class="col-sm-9">
            <input name="data[url]" class="col-sm-5 col-xs-10" id="bookurl"  placeholder="书id或链接地址" type="text">
                <p class="btn" onclick="getBook()" >确定</p>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-3">书籍分类</label>
        <div class="col-sm-9">
            <select name="data[tid]" class="tid"  style="height:27px;width:41.6667%;line-height:27px;color:#000;outline:none;">
                <option value="">---请选择---</option>
                <volist name="type" id="vt">
                    <option value="{$vt.id}">{$vt.name}</option>
                </volist>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-3">性别分类</label>
        <div class="col-sm-9">
            <label class="radio-inline">
                <input name="data[sex]"  class="sex" checked="checked" type="radio"  value="1" autocomplete="off">
                <span>男生</span>
            </label>&nbsp;&nbsp;&nbsp;&nbsp;
            <label class="radio-inline">
                <input name="data[sex]"  class="sex" type="radio"  value="2"  autocomplete="off">
                <span>女生</span>
            </label>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-3">状态</label>
        <div class="col-sm-9">
            <label class="radio-inline">
                <input name="data[state]" class="state" checked="checked" type="radio"  value="0" autocomplete="off">
                <span>连载</span>
            </label>&nbsp;&nbsp;&nbsp;&nbsp;
            <label class="radio-inline">
                <input name="data[state]" class="state" type="radio"  value="1"  autocomplete="off">
                <span>完结</span>
            </label>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-3">书籍名称</label>
        <div class="col-sm-9">
            <input name="data[title]" class="title" class="col-sm-5 col-xs-10"  value="" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-3">作者</label>
        <div class="col-sm-9">
            <input name="data[author]" class="author" class="col-sm-5 col-xs-10"  value="" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-3">来源</label>
        <div class="col-sm-9">
            <input name="data[source]" class="source" class="col-sm-5 col-xs-10"  value="" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-3">章节数</label>
        <div class="col-sm-9">
            <input name="data[num]" class="count" class="col-sm-5 col-xs-10"  value="" type="text">  <span style="color:red;">检查章节数是否准确</span>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-3">封面图片</label>
        <div class="col-sm-9">
            <input name="data[img]" class="img" class="col-sm-5 col-xs-10"  type="text">
        </div>
        <div class="col-sm-9">
            <img style="width:100px;" src="" class="img">
        </div>
    </div>
    
    <div class="form-group">
        <label class="control-label col-sm-3">书籍简介</label>
        <div class="col-sm-9">
            <textarea name="data[content]" class="content" style="width:530px;height:250px;resize: none;"></textarea>
        </div>
    </div>


    <div class="clearfix form-actions">
        <div class="col-md-offset-3 col-md-9">
            <button type="submit" class="btn btn-info" data-bind="click: submit, disable: submitting">保存</button>
        </div>
    </div>
</form>


                                <!-- PAGE CONTENT ENDS -->
                            </div><!-- /.col -->
                        </div><!-- /.row -->
                    </div><!-- /.page-content-area -->
                </div><!-- /.page-content -->
            </div><!-- /.main-content -->

        </div><!-- /.main-container -->
        <script src="__PUBLIC__/admin/js/bootstrap.min.js"></script>
        <script src="__PUBLIC__/admin/js/jquery.webui-popover.min.js"></script>
        <script src="__PUBLIC__/admin/js/jquery.ui.widget.min.js"></script>
        <script src="__PUBLIC__/admin/js/jquery.fileupload.min.js"></script>


<script>
    function getBook(){
        var url = $('#bookurl').val();
        $.post('downbook',{url:url},function(resp){
            var data = JSON.parse(resp);
            for(a in data){
                console.log(a);
                $('.'+a).val(data[a]);
                $('.'+a).attr('src',data[a]);
            }
            console.log(data);
        });
    }
    
</script>
</body>
</html>
